package com.itxg.booksmanage.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class Book implements Serializable {

    private static final long serialVersionUID = 1L;
    // 图书 id
    @TableId(type = IdType.AUTO)
    private Integer id;
    // 书名
    private String bookName;
    // 书类型（用于查询 DB）
    private Integer bookType;
    // 作者
    private String author;
    // 封面图片链接
    private String coverUrl;
    // 图书描述
    private String bookDesc;
    // 价格
    private Double price;
    // 书类型（用于展示）
    @TableField(exist = false)
    private String bookTypeStr;
    // 时间戳
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private LocalDateTime createTime;
}
